<script>
	import { TabBarManager, TabBarMode } from '@/utils/tabbar.js'
	
	export default {
		onLaunch: function() {
			console.log('App Launch')
			
			// 初始化TabBar模式并获取启动页面
			const startupUrl = TabBarManager.getStartupUrl()
			console.log('Startup URL:', startupUrl)
			
			// 延迟跳转到正确的启动页面
			setTimeout(() => {
				const pages = getCurrentPages()
				const currentPage = pages[pages.length - 1]
				const currentRoute = currentPage ? currentPage.route : ''
				
				console.log('Current Route:', currentRoute)
				
				// 检查是否需要跳转到正确的启动页面
				const targetRoute = startupUrl.replace('/', '')
				if (currentRoute !== targetRoute) {
					console.log('Redirecting to:', startupUrl)
					uni.reLaunch({
						url: startupUrl
					})
				}
			}, 100)
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>
